package com.qfedu.edu.observer.notify.impl;

import com.qfedu.edu.observer.notify.base.Observer;
import com.qfedu.edu.observer.notify.base.Subject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Slf4j
public class SubjectObserver implements Subject {
    @Autowired
    private List<Observer> observers;
    @Override
    public void notifyList(String msg) {
        for (int i = 0; i < observers.size(); i++) {
            observers.get(i).notifyList(msg);
        }
    }
}
